package com.cellngine.hub;

import com.cellngine.Constants;
import com.cellngine.cellngine;

/**
 * cellngine hub server
 * 
 * This class is the bootstrap loader for the central hub server.
 * Features (planned):
 * - Authentication between servers (by storing and broadcasting public keys)
 * - Central cellngine server database
 * - cellngine online services (such as an 'association provider')
 * 
 * @author Jozef Boer <jboer@jboer.nl>
 */
public class Hub
{
	private static WebServer	server;
	
	/**
	 * @param args
	 */
	public static void main(final String[] args)
	{
		new cellngine();
		
		cellngine.log("cellngine hub server " + cellngine.getVersion() + " is starting!",
				Constants.log_type.info);
		
		server = new WebServer(8080);
		Runtime.getRuntime().addShutdownHook(new Thread(new Runnable()
		{
			@Override
			public void run()
			{
				System.out.println("Good-bye!");
				server.close();
			}
		}));
		
		while (true)
		{
			Thread.yield();
			try
			{
				Thread.sleep(1000);
			}
			catch (final InterruptedException e)
			{
			}
		}
	}
}